﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1 {
    class Story {
        private ConsoleHandler ch;
        public Player p;
        private Map m;

        public Story(ConsoleHandler ch, Player pp, Map mm) {
            this.ch = ch;
            this.p = pp;
            this.m = mm;
            this.m.setStory(this);
        }

        public void tellStory(string s, String ss = "") {
            ch.write(ss);
            //ch.write(s + " ");//debug om te kijken wat voor case we moeten printen
            switch (s) {
                case "menu":
                    ch.writeLine("\tWelcome to Viva Las Vegas baby");
                    ch.writeLine("The almigty gambling city in the state of Nevada");
                    ch.writeLine();
                    ch.writeLine("Made by darin<Tdred> with assistance of Marcel Boelen.");
                    ch.writeLine();
                    ch.writeLine("<Twhite>\tMenu");
                    ch.writeLine("<Twhite>\t1<Tgreen> Start");
                    ch.writeLine("<Twhite>\t2<Tyellow> About");
                    ch.writeLine("<Twhite>\t3<Tred> Quit");
                    break;
                case "about":
                    ch.writeLine("This is an entire text-based game.");
                    ch.writeLine();
                    ch.writeLine("The adventure is about surviving a horde of zombies");
                    ch.writeLine("These zombies are chasing you in the famous, but abandoned, Las Vegas");
                    break;
                case "quit":
                    ch.writeLine("The thoughts of being haunted by a horde of brain eating zombies scares you away");
                    //ch.writeLine("You commited suicide and didn't wake up out of this horror.\nGameover.");
                    break;
                case "presskey_clearscreen":
                    ch.writeLine("<Tgray>Press ENTER to continue");
                    ch.read();
                    ch.clearScreen();
                    break;
                case "presskey_resetline":
                    ch.writeLine("<Tgray>Press ENTER to continue");
                    ch.read();
                    ch.resetDoubleLine();
                    break;


                case "prologue_intro":
                    ch.writeLine();
                    ch.writeLine("36 days ago, something strange happened to the city");
                    ch.writeLine("Somehow the dead started walking again,");
                    ch.writeLine("\tand turned the living into walking zombies!");
                    //TODO MEER VERHAAL
                    tellStory("presskey_resetline");
                    ch.writeLine();
                    ch.writeLine("Apperently you hitted your head against a hard object and lost your memories");
                    ch.writeLine("Someone found you and brought you to her home.");
                    ch.writeLine("What is your name? she asks.");
                    //TODO MEER VERHAAL
                    String player = ch.read("white");
                    p.setName(player);
                    ch.resetLine(); ch.writeLine();
                    ch.writeLine("Soooo... <Twhite>" + p.getName() + "<Treset>...Isn't that a strange name for a girl???");
                    ch.writeLine("1: I'm NOT a girl");
                    ch.writeLine("2: It isn't a strange name..");
                    int name = ch.readInt(1, 2);
                    ch.resetDoubleLine();
                    ch.resetDoubleLine();
                    switch (name) {
                        case 1:
                            ch.writeLine("<Twhite>a Male.. <Treset>Well sorry for my mistake than <Twhite>" + p.getName() + "<Treset>. My name is Alice.");
                            p.setSex("male");
                            break;
                        case 2:
                            ch.writeLine("<Twhite>a Female.. <Treset>Well i guess so... Maybe your parents wanted to call you <Twhite>" + p.getName() + "<Treset> so badly");
                            p.setSex("female");
                            break;
                    }
                    tellStory("prologue_start");
                    break;

                case "prologue_start":
                    ch.writeLine("But hey,. It doesn't matter how others name you. *laughed loudly*");
                    ch.writeLine("Zombies will try to eat you anywayz");
                    tellStory("presskey_resetline");
                    ch.writeLine();
                    ch.writeLine("I hope you are well prepared because this is were i leave you.");
                    ch.writeLine("I'm going to hide in that building over there! *Points*");
                    ch.writeLine("Goodluck and try to stay alive!");
                    tellStory("presskey_clearscreen");
                    break;


                case "0,0":
                    ch.writeLine("Start");
                    break;
                case "on_0,0" :
                    ch.writeLine("We zijn nu bij de start "+ p.getName());
                    break;
                case "1,0":
                    ch.writeLine("All you see is just a ruined world full with zombies, There is nothing here to do");
                    break;
                case "1,2":
                    ch.writeLine("While sneaking past some zombies you see there is nothing left...");
                    break;
                case "1,3":
                    ch.writeLine("Alice asks: Where should we go? we can't only walk on a straight path.");
                    break;
                case "1,4":
                    ch.writeLine("Now that you passed all the zombies, your trying to find a way out of vegas");
                    break;
                case "1,5":
                    ch.writeLine("Most of the things here are ruined by the post-nucliar war that was going on here...Toobad");
                    break;
                case "1,6":
                    ch.writeLine("Alice asks:'should we really go this way?'");
                    break;
                case "2,1":
                    ch.writeLine("You spotted some zombies and hid quickly before they saw you.");
                    break;
                case "2,2":
                    ch.writeLine("Wall-hax");
                    break;
                case "2,3":
                    ch.writeLine("Wall-hax");
                    break;
                case "2,4":
                    ch.writeLine("Some of the lights are flickering on and off. It's distracting the zombies...");
                    break;
                case "2,5":
                    ch.writeLine("Wall-hax");
                    break;
                case "2,6":
                    ch.writeLine("When your walking down the street, you see a corpse that if completely shred by zombies.");
                    break;
                case "3,1":
                    ch.writeLine("While walking down the street, You see a little shop east from you.");
                    break;
                case "3,2":
                    ch.writeLine("Noting intresting in the shop...Only some empty tin cans...");
                    break;
                case "3,3":
                    ch.writeLine("Wall-hax");
                    break;
                case "3,4":
                    ch.writeLine("You smell something really discusting and walked away quickly.");
                    break;
                case "3,5":
                    ch.writeLine("Wall-hax");
                    break;
                case "3,6":
                    ch.writeLine("Your feeling hungry because you haven't eat since you wake up...Maybe some a supermarket does have some supplies");
                    break;
                case "4,1":
                    ch.writeLine("When you crossed the street a zombie tried to catch you, Lucky you he only has one leg");
                    break;
                case "4,2":
                    ch.writeLine("There is a Shop. Maybe there is something there...");
                    break;
                case "4,3":
                    ch.writeLine("Mhm..Another shop, There could be some food.");
                    break;
                case "4,4":
                    ch.writeLine("Alice says:'This is really a nightmare, It's all a bad dream i hope.");
                    break;
                case "4,5":
                    ch.writeLine("Wall-hax");
                    break;
                case "4,6":
                    ch.writeLine("You see some kind of outpost but most likely it's not reachable");
                    break;
                case "5,1":
                    ch.writeLine("Alice says:'Well F%@#% a dead end, This is going nowhere.");
                    break;
                case "5,2":
                    ch.writeLine("Wall-hax");
                    break;
                case "5,3":
                    ch.writeLine("Again a store with nothing inside... Just some dead corpses");
                    break;
                case "5,4":
                    ch.writeLine("the only thing that you heard was a scream when you passed around the road");
                    break;
                case "5,5":
                    ch.writeLine("Wall-hax");
                    break;
                case "5,6":
                    ch.writeLine("ALMOST THERE, THERE IS NOTHING THAT CAN STOP ME NOW.");
                    break;
                case "6,1":
                    ch.writeLine("Wall-hax");
                    break;
                case "6,2":
                    ch.writeLine("Wall-hax");
                    break;
                case "6,3":
                    ch.writeLine("Wall-hax");
                    break;
                case "6,4":
                    ch.writeLine("Wall-hax");
                    break;
                case "6,5":
                    ch.writeLine("Wall-hax");
                    break;
                case "6,6":
                    ch.writeLine("You made it...or didn't you..");
                    break;
                default:
                    if(!s.StartsWith("on")){
                        ch.write("Nothing there\n\r");
                    }
                    break;
            }
        }
    }
}
